package com.zhkj.txg.module.home.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.txg.R
import com.zhkj.txg.module.home.entity.NavigationEntity

class MarketCatePopupAdapter :
    BaseQuickAdapter<NavigationEntity, BaseViewHolder>(R.layout.item_market_tab_popup) {

    var selectedPosition = 0
        private set

    override fun convert(helper: BaseViewHolder, item: NavigationEntity) {
        helper.setText(R.id.tvMarketTab, item.name)
        helper.itemView.isSelected = selectedPosition == helper.layoutPosition
    }

    fun selectPosition(position: Int) {
        selectedPosition = position
        notifyDataSetChanged()
    }
}